package HttpPages;

import java.util.Vector;

import javax.ws.rs.FormParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import Database.Database;
import Objects.UserProfile;


@Path("/usersPositions")
public class UsersPositions
{

	//-----------------------------------http methods--------------------------------

//	@POST
//	@Produces(MediaType.TEXT_PLAIN)
//	public String sayPlainTextHello() {
//		System.out.println("requested TEXT_PLAIN");
//		AppLogger.write(Level.WARNING, "requested TEXT_PLAIN");
//		return "Hello Jersey";
//	}
	
	@POST
	@Produces(MediaType.APPLICATION_XML)
	public Vector<UserProfile> getObjInXml(@FormParam("x1") String x1, 
			@FormParam("y1") String y1, @FormParam("x2") String x2,
			@FormParam("y2") String y2) {
		System.out.println("requested usersPositions APPLICATION_XML: ("+x1+","+y1+"),("+x2+","+y2+")");
		return Database.getInstance().getUsersInLocation(Double.valueOf(x1),
				Double.valueOf(y1),Double.valueOf(x2),Double.valueOf(y2));
	}

}
